From 8ca0ed2cde1176af5adc1c49dc4c14c480f41cbf Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 28 Sep 2011 16:31:11 +0100 Subject: [PATCH] libxl: fail to parse disk vpath if a disk+part number needed but unavailable libxl__device_disk_dev_number() can parse a virtpath which is an encoded unsigned long but does not set *pdisk or *ppartition in that case. Ideally we would parse the number but for now simply fail to prevent cascading failures. Signed-off-by: Ian Campbell Acked-by: Ian Jackson Committed-by: Ian Jackson --- tools/libxl/libxl_device.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c index 7931b11abc..124ea4cd70 100644 --- a/tools/libxl/libxl_device.c +++ b/tools/libxl/libxl_device.c @@ -341,8 +341,12 @@ int libxl__device_disk_dev_number(const char *virtpath, int *pdisk, errno = 0; ul = strtoul(virtpath, &ep, 0); - if (!errno && !*ep && ul <= INT_MAX) + if (!errno && !*ep && ul <= INT_MAX) { + /* FIXME: should parse ul to determine these. */ + if (pdisk || ppartition) + return -1; return ul; + } if (device_virtdisk_matches(virtpath, "hd", &disk, 3, -- 2.30.2